#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>


using namespace std;

int temp[200010];
int ans[200010];

int main()
{
	long long n, k, x;
	cin >> n >> k >> x;
	for (int i = 1; i <= n; i++)
	{
		cin >> temp[i];
	}
	long long times = k % x;
	int p = 1;
	while (n--)
	{
		if (times != n)
		{
			ans[times] = temp[p];
			times++; p++;
		}
		else
		{
			times = 1;
		}
	}
	for (int i = 1; i <= n; i++)
	{
		cout << ans[i] << " ";
	}
	return 0;
}